package com.cyam.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cyam.service.ArticleService;
import com.cyam.util.Pager;

@Controller
public class IndexController {
	@Resource
	private ArticleService articleService;
	
	/**
	 * 首页
	 * @param model
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/index")
	public String viewIndex(Model model) throws Exception {
		Pager pages = articleService.countPager(null,1, 8);
		model.addAttribute("pages", pages);
		return "index";
	}
}
